<template>
  <div class="projectList">
    <el-button type="primary" @click="addProject(0)" size="small"
      >添加新项目</el-button
    >
    <el-input
      v-model.trim="keywords"
      style="width: 200px"
      clearable
      placeholder="请输入项目名/负责人"
      @keydown.enter.native="search"
      size="small"
    ></el-input>
    <el-select v-model="level" placeholder="请选择" clearable size="small">
      <el-option
        v-for="item in gradeList"
        :key="item.id"
        :label="item.label"
        :value="item.id"
      ></el-option>
    </el-select>
    <el-button type="primary" @click="search" size="small">搜索</el-button>
    <el-button class="projectCloseBtn" @click="closeProjectList" size="small"
      >关闭项目</el-button
    >
    <br />
    <br />
    <el-tabs v-model="plateId" type="card" @tab-click="handleClick">
      <el-tab-pane label="全部" name="0"></el-tab-pane>
      <el-tab-pane
        v-for="(item, index) in plateOption"
        :key="index"
        :label="item.name"
        :name="item.id + ''"
      ></el-tab-pane>
    </el-tabs>
    <base-table
      ref="baseTable"
      :tableSetting="tableSetting"
      :pns="pns"
      :pn1="pn1"
      @showColse="showColse"
      @handleCommon="handleCommon"
      @getTotal="getTotal"
      @PauseToOpen="PauseToOpen"
      @sortTable="sortTable"
      @ShowFlag="ShowFlag"
      @record="record"
      @projectObjectives="projectObjectives"
    ></base-table>

    <!-- 项目添加-编辑弹窗 -->
    <el-dialog
      :title="titleStation"
      :close-on-click-modal="false"
      :show-close="false"
      :visible.sync="dialogStation"
      width="500px"
      center
      @close="handleclickiClose"
    >
      <el-form
        status-icon
        label-width="120px"
        :model="form"
        :rules="rules"
        ref="form"
        class="demo-ruleForm"
      >
        <el-form-item label="项目全称" prop="fullName">
          <el-input
            v-model.trim="form.fullName"
            placeholder="请输入项目全称"
          ></el-input>
        </el-form-item>
        <el-form-item label="项目简称" prop="name">
          <el-input
            v-model.trim="form.name"
            placeholder="请输入项目简称"
          ></el-input>
        </el-form-item>
        <el-form-item label="合同单位" prop="contractUnit">
          <el-input
            v-model.trim="form.contractUnit"
            placeholder="请输入合同单位"
          ></el-input>
        </el-form-item>
        <el-form-item label="主体单位" prop="mainUnit">
          <el-input
            v-model.trim="form.mainUnit"
            placeholder="请输入主体单位"
          ></el-input>
        </el-form-item>
        <el-form-item label="项目类型" prop="projectType">
          <el-select v-model="form.projectType" placeholder="请选择项目类型">
            <el-option
              v-for="item in projectTypeList"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="版本号" v-if="falg == 1">
          {{ versionNum }}
        </el-form-item>
        <el-form-item label="需求责任人" prop="demandUserId" v-if="falg == 1">
          <el-select
            v-model="form.demandUserId"
            multiple
            placeholder="请选择需求责任人"
          >
            <el-option
              v-for="(item, index) in demandUserList"
              :key="index"
              :label="item.name"
              :value="item.id"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="项目级别" prop="level">
          <el-select v-model="form.level" placeholder="请选择项目级别">
            <el-option
              v-for="item in gradeList"
              :key="item.id"
              :label="item.label"
              :value="item.id"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="所属板块" prop="plateId">
          <el-select v-model="form.plateId" placeholder="请选择所属板块">
            <el-option
              v-for="item in plateOption"
              :key="item.id"
              :label="item.name"
              :value="item.id"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="开始日期" prop="realStartDate">
          <el-date-picker
            v-model="form.realStartDate"
            value-format="yyyy-MM-dd"
            type="date"
            placeholder="选择开始日期"
          ></el-date-picker>
        </el-form-item>
        <el-form-item label="计划结束日期" prop="planEndDate">
          <el-date-picker
            v-model="form.planEndDate"
            value-format="yyyy-MM-dd"
            type="date"
            placeholder="选择计划结束日期"
          ></el-date-picker>
        </el-form-item>
        <el-form-item label="项目经理" prop="leader1">
          <el-select v-model="form.leader1" placeholder="请选择项目经理">
            <el-option
              v-for="item in memberList"
              :key="item.id"
              :label="item.name"
              :value="item.id"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="项目状态" prop="status">
          <el-select v-model="form.status" placeholder="请选择项目状态">
            <el-option
              v-for="item in statusList"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="实际结束日期" v-if="falg == 2">
          <el-date-picker
            v-model="form.realEndDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="选择实际结束日期"
          ></el-date-picker>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogStation = false">取 消</el-button>
        <el-button type="primary" @click="handleSave('form')" :loading="loading"
          >确 定</el-button
        >
      </span>
    </el-dialog>
    <!-- 记录 -->
    <el-dialog
      :close-on-click-modal="false"
      :visible.sync="dialogRecord"
      width="805px"
      center
      @close="__close"
    >
      <div class="rscordTop">
        <p>
          <span>
            <h1 class="level1" v-if="this.proInfo.level == 'A'">
              {{ proInfo.level }} 级
            </h1>
            <h1 class="level2" v-if="this.proInfo.level == 'B'">
              {{ proInfo.level }} 级
            </h1>
            <h1 class="level3" v-if="this.proInfo.level == 'C'">
              {{ proInfo.level }} 级
            </h1>
            <h1 class="level4" v-if="this.proInfo.level == 'D'">
              {{ proInfo.level }} 级
            </h1>
            <h3>{{ proInfo.name }}</h3>
            <span>负责人：{{ proInfo.leader1name }}</span>
          </span>
          <span>
            <span>{{ proInfo.realStartDate }}至{{ proInfo.planEndDate }}</span>
            <span>{{ proInfo.prjStatus }}</span>
          </span>
        </p>
        <div class="mainWrap">
          <el-input
            style="width: 655px; margin-left: -13px"
            type="textarea"
            :autosize="{ minRows: 7, maxRows: 12 }"
            @input="handleChangeText"
            placeholder="请输入内容"
            v-model="content"
          ></el-input>
        </div>
      </div>
      <span class="dialogFooter">
        <el-button @click="dialogRecord = false">取 消</el-button>
        <el-button type="primary" @click="addRecord('form')" :loading="loading"
          >确 定</el-button
        >
      </span>
      <el-timeline v-if="recordList.length > 0">
        <el-timeline-item
          v-for="(item, index) in recordList"
          :key="index"
          :timestamp="item.createTime.replace('T', ' ')"
          placement="top"
        >
          <el-card>
            <el-row class="content-box" type="flex" justify="space-between">
              <el-col :span="22">
                <el-input
                  type="textarea"
                  autosize
                  placeholder="请输入内容"
                  v-model="item.content"
                >
                </el-input>
              </el-col>
              <el-col :span="2">
                <el-button
                  size="mini"
                  @click="delRecord(item)"
                  class="closeBtn el-icon-delete"
                  round
                ></el-button>
              </el-col>
            </el-row>

            <!-- <h4>
              <pre class="text-wrap">{{ item.content }}</pre>
            </h4> -->
            <p>
              {{ item.recordName }} 提交于
              {{ item.createTime.replace("T", " ") }}
            </p>
          </el-card>
        </el-timeline-item>
      </el-timeline>
      <p v-else style="text-align: center">--暂无记录--</p>
      <!-- 分页 -->
      <el-pagination
        style="text-align: right"
        background
        @size-change="handleSizeChange"
        @current-change="handleChangePage"
        :current-page="pn"
        :page-sizes="[5, 10, 15, 20, 30, 40]"
        :page-size="ps"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total"
      ></el-pagination>
    </el-dialog>
  </div>
</template>
<script>
import baseTable from "@/components/table/baseTable";
import {
  selectProjectListByReq,
  insertProject,
  selectProjectPlate,
  selectAllUser,
  updateProject,
  selectProjectRecord,
  insertProjectRecord,
  deleteProjectRecord,
  selectProjectById,
  closeProject,
  prjStopOrBegin,
  getRequirementUserDuty,
  showFlag,
} from "@/service/Api.js"; //接口

import { getPrincipalList } from "@/service/progressApi";

export default {
  components: { baseTable },
  name: "projectMent",
  props: ["pns"],
  data() {
    // var validatePass = (rule, value, callback) => {
    //   if (value === "") {
    //     callback(new Error("请选择项目状态"));
    //   } else {
    //     callback();
    //   }
    // };
    return {
      tableSetting: {
        defaulteParams: {
          projectNameKeyWord: "",
          principalNameKeyWord: "",
          level: "",
          plateId: "",
          status: "",
        },
        tabletype: "selection",
        tableApiFn: selectProjectListByReq,
        options: [
          { prop: "id", label: "ID", width: "60px" },
          // { prop: "fullName", label: "项目全称", width: "100px" },
          { prop: "name", label: "项目简称", width: "250px" },
          // { prop: "contractUnit", label: "合同单位", width: "100px" },
          // { prop: "mainUnit", label: "主体单位", width: "100px" },
          {
            prop: "projectTypeName",
            label: "项目类别",
            sortable: "custom",
            width: "150px",
          },
          {
            prop: "level",
            label: "级别",
            sortable: "custom",
            width: "100px",
          },
          // {
          //   prop: "createTime",
          //   label: "创建时间",
          //   sortable: "custom",
          //   width: "110px",
          // },
          // {
          //   prop: "realStartDate",
          //   label: "开始日期",
          //   sortable: "custom",
          //   width: "110px",
          // },
          // {
          //   prop: "planEndDate",
          //   label: "计划结束",
          //   sortable: "custom",
          //   width: "110px",
          // },
          { prop: "leader1name", label: "项目经理", width: "150px" },
          { prop: "prjStatus", label: "项目状态", width: "150px" },
          { prop: "manhour", label: "已用工时", width: "150px" },
          // {
          //   prop: "devStatus",
          //   label: "开发状态",
          //   sortable: "custom",
          //   width: "110px",
          // },
          // {
          //   prop: "showFlag",
          //   label: "大屏显示状态",
          //   sortable: "custom",
          //   width: "150px",
          // },
        ],
        width: "560",
        btns: [
          // { text: "记录", size: "mini", handleName: "record" },
          { text: "编辑", size: "mini", handleName: "addProject" },
          {
            text: "成员管理",
            size: "mini",
            handleName: "memberMent",
            type: "success",
          },
          {
            text: "进度管理",
            size: "mini",
            handleName: "goProgressManager",
          },

          {
            text: "查看工时",
            size: "mini",
            handleName: "tomanHour",
            type: "info",
          },
          {
            text: "查看日报",
            size: "mini",
            handleName: "handleDaily",
            type: "info",
          },
          // {
          //   text: "项目目标",
          //   size: "mini",
          //   handleName: "projectObjectives",
          // },
          // {text: "暂停开启", size: "mini", handleName: "PauseToOpen", type: "primary"},
        ],
      },
      tableChange: [],
      versionNum: "V1.0",
      sortColunm: undefined,
      sortWay: undefined,
      dialogStation: false,
      projectid: "",
      form: {
        fullName: "",
        name: "",
        contractUnit: "",
        mainUnit: "",
        projectType: "",
        projectTypeName: "",
        demandUserId: "",
        level: "",
        plateId: "",
        realStartDate: "",
        planEndDate: "",
        leader1: "",
        status: "",
        realEndDate: "",
      },
      rules: {
        fullName: [
          {
            required: true,
            message: "请输入项目全称",
            trigger: "blur",
          },
        ],
        name: [
          {
            required: true,
            message: "请输入项目简称",
            trigger: "blur",
          },
        ],
        contractUnit: [
          {
            required: true,
            message: "请输入合同单位",
            trigger: "blur",
          },
        ],
        mainUnit: [
          {
            required: true,
            message: "请输入主体单位",
            trigger: "blur",
          },
        ],
        projectType: [
          {
            required: true,
            message: "请选择项目类型",
            trigger: "change",
          },
        ],
        demandUserId: [
          {
            required: true,
            message: "请选择需求责任人",
            // trigger: ["blur", "change"],
            trigger: "change",
          },
        ],
        level: [
          {
            required: true,
            message: "请选择项目级别",
            // trigger: ["blur", "change"],
            trigger: "change",
          },
        ],
        plateId: [
          {
            required: true,
            message: "请选择所属板块",
            // trigger: ["blur", "change"],
            trigger: "change",
          },
        ],
        realStartDate: [
          {
            required: true,
            message: "请选择开始日期",
            // trigger: ["blur", "change"],
            trigger: "change",
          },
        ],
        planEndDate: [
          {
            required: true,
            message: "请选择计划结束日期",
            // trigger: ["blur", "change"],
            trigger: "change",
          },
        ],
        leader1: [
          {
            required: true,
            message: "请选择项目经理",
            // trigger: ["blur", "change"],
            trigger: "change",
          },
        ],
        status: [
          {
            required: true,
            // validator: validatePass,
            message: "请选择项目状态",
            trigger: "change",
          },
        ],
      },
      loading: false,
      titleStation: "",
      projectTypeList: [
        {
          value: 1,
          label: "管理类",
        },
        {
          value: 2,
          label: "自研产品",
        },
        {
          value: 3,
          label: "委托开发",
        },
        {
          value: 4,
          label: "市场",
        },
      ], //项目类型：1、管理类 2、自研产品 3、委托开发 4、市场
      demandUserList: [], //选择需求责任人
      memberList: [], //选择项目经理
      // 项目状态。1：立项；2：需求分析；3：系统设计；4：编码实现；5：内部测试；6：线上测试；7：上线试运行；8：已交付，售后阶段；9：项目取消
      statusList: [
        {
          value: 1,
          label: "立项",
        },
        {
          value: 2,
          label: "需求分析",
        },
        {
          value: 3,
          label: "系统设计",
        },
        {
          value: 4,
          label: "编码实现",
        },
        {
          value: 5,
          label: "内部测试",
        },
        {
          value: 6,
          label: "线上测试",
        },
        {
          value: 7,
          label: "上线试运行",
        },
        {
          value: 8,
          label: "已交付",
        },
        {
          value: 9,
          label: "项目取消",
        },
        {
          value: 10,
          label: "项目关闭",
        },
      ],
      keywords: "",
      level: "",
      plateId: "0",
      gradeList: [
        {
          id: "A",
          label: "A",
        },
        {
          id: "B",
          label: "B",
        },
        {
          id: "C",
          label: "C",
        },
        {
          id: "D",
          label: "D",
        },
      ],
      plateOption: [],
      falg: "",
      //记录
      dialogRecord: false,
      projectId: "",
      recordList: [],
      pn: 1,
      ps: 10,
      total: 0,
      content: "",
      proInfo: "",
      pn1: this.$route.params.pn1,
    };
  },
  created() {
    this.plateList();
    // console.log("pns",this.pns);
    // console.log("pn1",this.pn1);
  },
  methods: {
    sortTable(val) {
      //       sortColunm: "",
      // sortWay: undefined,
      let str = "";
      switch (val.val) {
        case "projectType":
          str = "projectType";
          break;
        case "level":
          str = "level";
          break;
        case "createTime":
          str = "create_time";
          break;
        case "realStartDate":
          str = "real_start_date";
          break;
        case "planEndDate":
          str = "plan_end_date";
          break;
        case "devStatus":
          str = "dev_status";
          break;
        case "projectTypeName":
          str = "project_type";
          break;
        default:
          str = "";
      }
      this.sortColunm = str;
      this.sortWay = val.flag;
      this.search();
    },
    handleCommon(name, row, idx) {
      if (this[name]) {
        this[name](row, idx);
      }
    },
    __close() {
      this.$refs.baseTable.initData();
    },
    // 板块列表
    plateList() {
      selectProjectPlate().then((res) => {
        if (res.code == 0) {
          this.plateOption = res.data;
        }
      });
    },
    handleClick() {
      this.search();
    },
    // 搜索
    search() {
      this.tableSetting.defaulteParams = {
        projectKeyWord: this.keywords,
        level: this.level,
        plateId: this.plateId,
        sortColunm: this.sortColunm,
        sortWay: this.sortWay,
      };
      this.$refs.baseTable.initData(null, 1);
    },
    handleChangePage(index) {
      this.pn = index;
      this.recordOption();
    },
    handleSizeChange(val) {
      this.ps = val;
      this.recordOption();
    },
    getTotal(val) {
      this.pn = val;
      // console.log("val", val);
    },
    //记录列表
    recordOption() {
      let data = {
        pn: this.pn,
        ps: this.ps,
        projectId: this.projectId,
        recordType: "1",
      };
      selectProjectRecord(data).then((res) => {
        if (res.code == 0) {
          this.recordList = res.data.records;
          this.total = res.data.total;
        }
      });
    },
    //项目信息
    projectInfo() {
      selectProjectById(this.projectId).then((res) => {
        if (res.code == 0) {
          this.proInfo = res.data;
        }
      });
    },
    handleChangeText(val) {
      if (val && val.length % 44 === 0) {
        this.content += "/\n";
      }
    },
    // 记录
    record(row) {
      this.projectId = row.id;
      this.projectInfo();
      this.pn = 1;
      this.recordOption();
      this.dialogRecord = true;
    },
    //添加记录
    addRecord() {
      if (!this.content) {
        this.$message.warning("请输入内容！");
        return;
      }
      let data = {
        projectId: this.projectId,
        content: this.content,
        type: "1",
      };
      insertProjectRecord(data).then((res) => {
        if (res.code == 0) {
          this.content = "";
          this.$message.success("添加成功！");
          this.recordOption();
        }
      });
    },
    delRecord(row) {
      this.$confirm("此操作将永久删除该记录, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        center: true,
      })
        .then(() => {
          deleteProjectRecord(row.id).then((res) => {
            if (res.code == 0) {
              this.$message.success("删除成功！");
              this.recordOption();
            } else {
              this.$message.error(response.message);
            }
          });
        })
        .catch(() => {});
    },
    goProgressManager(row) {
      this.$router.push({
        path: "/progressManager",
        query: { projectId: row.id, projectName: row.name, pn: this.pn },
      });
      // console.log("进度管理传pn",this.pn);
    },
    projectObjectives(row) {
      this.$router.push({
        path: "/projectObjectives",
        query: { projectId: row.id, projectName: row.name, pn: this.pn },
      });
    },
    showColse(val) {
      this.tableChange = val;
    },
    closeProjectList() {
      if (this.tableChange.length == 0) {
        this.$message.warning("请选择你要关闭的项目");
        return;
      }
      this.$confirm("确定要关闭选中项目", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        center: true,
      })
        .then(() => {
          let arrIds = [];
          this.tableChange.forEach((element) => {
            arrIds.push(element.id);
          });
          closeProject(arrIds).then((res) => {
            if (res.code == 0) {
              this.$message.success("关闭成功！");
              this.$refs.baseTable.initData();
            }
          });
        })
        .catch(() => {});
    },
    PauseToOpen(row) {
      prjStopOrBegin(row.id, row.devStatus === 0 ? 1 : 0).then((res) => {
        this.$message.success(
          `${row.devStatus === 0 ? "暂停成功" : "开启成功"}`
        );
        //刷新页面
        this.$refs.baseTable.initData();
      });
    },
    ShowFlag(row) {
      if (row.showFlag == 0) {
        let data = {
          flag: 1,
          pId: row.id,
        };
        showFlag(data).then((res) => {
          if (res.code == 0) {
            this.$message({
              message: "显示成功",
              type: "success",
            });
          }
          this.$refs.baseTable.initData();
        });
      } else {
        let data = {
          flag: 0,
          pId: row.id,
        };
        showFlag(data).then((res) => {
          if (res.code == 0) {
            this.$message({
              message: "取消显示",
              type: "success",
            });
          }
          this.$refs.baseTable.initData();
        });
      }
    },
    //成员管理
    memberMent(row) {
      this.$emit("subset", {
        falg: 1,
        projectid: row.id,
        name: row.name,
        pn: this.pn,
      });
      // console.log("把pn传到成员管理里面", this.pn);
    },
    //工时管理
    tomanHour(row) {
      // sessionStorage.getItem('pn', )
      this.$emit("subset", { falg: 2, projectid: row.id, pn3: this.pn });
    },
    //查看日报
    handleDaily(row) {
      // /allDaily
      this.$router.push({
        path: "/allDaily",
        query: {
          projectId: row.id,
          projectName: row.name,
          condition: 1,
          pn: this.pn,
        },
      });
    },
    // 项目添加/编辑
    addProject(row) {
      console.log(1111, row);
      // this.form = {};
      this.managerData();
      this.dialogStation = true;
      // 默认清除校验
      this.$nextTick(() => {
        this.$refs["form"].clearValidate();
      });
      if (row === 0) {
        this.falg = 1;
        this.titleStation = "添加项目";
        this.form = {};

        // 初始化
        // this.form = {
        //   name: "",
        //   demandUserId: "",
        //   level: "",
        //   plateId: "",
        //   realStartDate: "",
        //   planEndDate: "",
        //   leader1: "",
        //   status: "",
        //   realEndDate: "",
        // };

        // 默认清除校验
        // this.$nextTick(() => {
        // this.$forceUpdate();
        // this.$set(this.form, this.form);
        // this.$refs["form"].clearValidate();
        // this.$refs["form"].resetFields();
        // });
      } else {
        this.falg = 2;
        this.titleStation = "修改项目";
        this.projectid = row.id;
        this.form.demandUserId = row.demandUserId
          ? row.demandUserId.split(",").map((item) => Number(item))
          : "";
        this.form = {
          fullName: row.fullName,
          name: row.name,
          contractUnit: row.contractUnit,
          mainUnit: row.mainUnit,
          projectType: row.projectType,
          demandUserId: row.demandUserId,
          level: row.level,
          plateId: row.plateId,
          realStartDate: row.realStartDate,
          planEndDate: row.planEndDate,
          leader1: row.leader1,
          status: row.status,
          realEndDate: row.realEndDate,
        };
      }
    },
    managerData() {
      //选择项目经理
      selectAllUser().then((res) => {
        if (res.code == 0) {
          this.memberList = res.data;
        } else {
          this.$message.warning(res.message);
        }
      });
      getRequirementUserDuty().then((res) => {
        console.log("需求责任人下拉框列表", res);
        if (res.code === 0) {
          if (res.data.length > 0) {
            this.demandUserList = res.data;
          }
        }
      });
      // getPrincipalList().then((res) => {
      //   if (res.data.length > 0) {
      //     this.demandUserList = res.data;
      //   }
      // });
    },
    handleSave(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          if (this.form.demandUserId) {
            this.form.demandUserId = this.form.demandUserId.join(",");
          }
          let formdata = {
            id: this.projectid,
            fullName: this.form.fullName,
            name: this.form.name,
            contractUnit: this.form.contractUnit,
            mainUnit: this.form.mainUnit,
            projectType: this.form.projectType,
            level: this.form.level,
            plateId: this.form.plateId,
            realStartDate: this.form.realStartDate,
            planEndDate: this.form.planEndDate,
            leader1: this.form.leader1,
            status: this.form.status,
            realEndDate: this.form.realEndDate,
          };
          let url;
          this.falg == 1
            ? (url = insertProject(this.form))
            : (url = updateProject(formdata));
          url.then((res) => {
            if (res.code == 0) {
              this.$message.success("操作成功!");
              this.handleclickiClose();
              this.$refs.baseTable.initData();
              // this.clickiClose("form");
            }
          });
        } else {
          return false;
        }
      });
    },

    // 弹窗取消回调
    handleclickiClose() {
      this.dialogStation = false;
      this.$nextTick(() => {
        // this.$forceUpdate();
        this.$set(
          this.form,
          (this.form = {
            fullName: "",
            name: "",
            contractUnit: "",
            mainUnit: "",
            projectType: "",
            demandUserId: "",
            level: "",
            plateId: "",
            realStartDate: "",
            planEndDate: "",
            leader1: "",
            status: "",
            realEndDate: "",
          })
        );
        // this.form = {};
        // this.form = {
        //   name: "",
        //   demandUserId: "",
        //   level: "",
        //   plateId: "",
        //   realStartDate: "",
        //   planEndDate: "",
        //   leader1: "",
        //   status: "",
        //   realEndDate: "",
        // };
        this.$refs["form"].resetFields();
      });
    },

    // 取消
    // clickiClose(formName) {
    //   this.form = {
    //     name: "",
    //     demandUserId: "",
    //     level: "",
    //     plateId: "",
    //     realStartDate: "",
    //     planEndDate: "",
    //     leader1: "",
    //     status: "",
    //     realEndDate: "",
    //   };
    //   this.dialogStation = false;

    //   console.log("看看", this.form);
    //   // debugger
    //   if (this.titleStation === "修改项目") {
    //     //   console.log("修改项目");
    //     // this.$nextTick(() => {

    //     this.$refs[formName].resetFields();
    //     // });
    //   } else {
    //     this.$refs[formName].clearValidate();
    //   }

    // 刷新页面
    // this.$refs.baseTable.initData();

    // this.form = {};
    // console.log("看看", this.form);
    // this.form.demandUserId = "";
    // },
  },
};
</script>

<style scoped>
.rscordTop p {
  margin-top: 0;
  display: flex;
  justify-content: space-between;
}

.rscordTop p span {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 50%;
}

.rscordTop p span h1,
.rscordTop p span h3 {
  margin: 0;
}

.rscordTop p span:nth-child(2) span {
  text-align: right;
  display: block;
}

.el-textarea__inner {
  min-height: 200px;
}

.dialogFooter {
  display: block;
  width: 100%;
  text-align: right !important;
  margin-top: 10px;
}

.content-box {
  margin-bottom: 15px;
}

.closeBtn {
  /* float: right; */
  margin-left: 10px;
}

.el-timeline {
  max-height: 450px;
  overflow: auto;
  padding: 0;
}

.el-card__body h4,
.el-card__body p {
  margin-top: 0;
}

.level1 {
  color: #f56c6c;
}

.level2 {
  color: #f5942c;
}

.level3 {
  color: #40b46f;
}

.level4 {
  color: #409eff;
}

.projectCloseBtn {
  background-color: #ee8585;
  color: #fff;
  border: none;
}

pre {
  margin: 0;
  padding: 0;
}

.text-wrap {
  word-wrap: break-word;
  white-space: pre-wrap;
  word-break: break-all;
}

.el-textarea.is-disabled .el-textarea__inner {
  border: none;
}

.mainWrap {
  display: flex;
  align-items: center;
  justify-content: center;
}
</style>
